Ext.define('Usws.view.video.Video', {
    extend: 'Ext.grid.Panel',
    xtype: 'Video-Grid',
    store: 'Video',
    title: '视频信息',
    selType:'checkboxmodel',
    multiSelect:true,
    stateId: 'sysStateGrid',
    layout:'fit',
    autoScroll: true,
    initComponent: function () {
    	this.tbar = [
    	             {
    	            	 xtype: 'panel',
    	            	 layout:'column',
    	            	 border:false,
    	            	 items:[
    	            	        {
							     xtype: 'form',
							     layout: 'hbox',
							  	 border:false,
							  	 id:'searchVideoForm',
							  	 margin:'5 5 5 5',
							  	 items:[
										{
											   xtype:'hiddenfield',
											   name:'videoTypeValue',
											   id:'videoTypeValue'
										  },
							  	       {
							  	    	   xtype:'textfield',
							  	    	   emptyText:'视频名称',
							  	    	   margin: '0 10 0 0',
							  	    	   id:'videoName',
							  	    	   name:'videoName'
							  	       },
							  	       {
					                        xtype: 'combobox',
					                        name: 'videoType',
					                        store: 'VideoType',
					                        emptyText:'视频类型',
					                        valueField: 'seqId',
					                        displayField: 'name',
					                        typeAhead: true,
					                        editable:false,
					                        queryMode:'local',
					                        margin: '0 10 0 0',
					                        id:'videoType'
					                    },
					                    { xtype:'button', text: '查询', action:'search', id:'searchVideoButton'}
							  	       ]
    	            	        },
    	            	        {
  								  xtype: 'panel',
  	    	       	              border:false,
  	    	       	              margin: '0 0 0 520',
  	    	       	              layout:'hbox',
  	    	       	              items:[
  	    	       	            	      {xtype: 'button', text: '添加视频',  action: 'add',margin:'5 5 5 5'},
  	    	          	                  {xtype: 'button', text: '批量删除',  action: 'deleteMore' ,margin:'5 5 5 5'}
  	    	       	            	    ]
  							    }
    	            	       ]
    	             }
    	            ];
        this.columns = [
			 {
				 text : '名称', 
				 width : '13%', 
				 sortable : true, 
				 dataIndex: 'name', 
				 hidden: false
			}
			,{
				 text : '类型', 
				 width : '8%', 
				 sortable : true, 
				 dataIndex: 'videoTypeName', 
				 hidden: false
			}
			,{text : '标签', width : '10%', sortable : true, dataIndex: 'tags', hidden: false}
			,{text : '创建人', width : '8%', sortable : true, dataIndex: 'createUserName', hidden: false}
			,{text : '角色', width : '8%', sortable : true, dataIndex: 'role', hidden: false}
			,{text : '创建时间', width : '13%', sortable : true, dataIndex: 'createDate',renderer: Ext.util.Format.dateRenderer('Y-m-d h:i:s'), hidden: false}
			,{text : '描述', width : '15%', sortable : true, dataIndex: 'description', hidden: false}
			,{text : '审核状态', width : '8%', sortable : true, dataIndex: 'authStatus', hidden: false}
            , {
	            text:'操作',
	            sortable: false,
	            xtype: 'actioncolumn',
	            margin:'5px',
	            align:'center',
	            width : '15%',
	            items: [
					{
						icon: '/ext4/resources/images/plugin_add.gif',  // Use a URL in the icon config
					    tooltip: '发布',
					    action: 'publish',
					    handler: function(grid,rowIndex,colIndex,item,e) {
					    	this.fireEvent('itemclick', this, grid, rowIndex, colIndex, item, e);
					    },
					    isDisabled: function(view, rowIdx, colIdx, item, record) {  
					    	var status = record.get('authStatusDsid');
					    	//alert(status);
					        if (status === 5) {
					            return false;
					        } else {
					        	return true;
					        }
					    }
					},'-',
					{
						icon: '/ext4/resources/images/information.png',  // Use a URL in the icon config
					    tooltip: '下架',
					    action: 'offline',
					    handler: function(grid,rowIndex,colIndex,item,e) {
					    	this.fireEvent('itemclick', this, grid, rowIndex, colIndex, item, e);
					    },
					    isDisabled: function(view, rowIdx, colIdx, item, record) {  
					    	var status = record.get('authStatusDsid');
					    	//alert(status);
					        if (status === 4) {
					            return false;
					        } else {
					        	return true;
					        }
					    }
					},'-',
					{
						icon: '/ext4/resources/images/user.png',  // Use a URL in the icon config
					    tooltip: '审核',
					    action: 'pending',
					    handler: function(grid,rowIndex,colIndex,item,e) {
					    	this.fireEvent('itemclick', this, grid, rowIndex, colIndex, item, e);
					    },
					    isDisabled: function(view, rowIdx, colIdx, item, record) {  
					    	var status = record.get('authStatusDsid');
					    	//alert(status);
					        if (status === 1) {
					            return false;
					        } else {
					        	return true;
					        }
					    }
					},'-',
	                {
	            	icon: '/ext4/resources/images/cog_edit.png',  // Use a URL in the icon config
	                tooltip: '编辑',
	                action: 'edit',
	                handler: function(grid,rowIndex,colIndex,item,e) {
	                	this.fireEvent('itemclick', this, grid, rowIndex, colIndex, item, e);
	                },
	                isDisabled: function(view, rowIdx, colIdx, item, record) {  
				    	var status = record.get('authStatusDsid');
				    	//alert(status);
				        if (status === 5 || status === 1) {
				            return false;
				        } else {
				        	return true;
				        }
				    }
	            },'-',{
	                icon: '/ext4/resources/images/delete.gif',
	                tooltip: '删除',
	                action: 'delete',
	                handler: function(grid,rowIndex,colIndex,item,e) {
	                	this.fireEvent('itemclick', this, grid, rowIndex, colIndex, item, e);
	                },
	                isDisabled: function(view, rowIdx, colIdx, item, record) {  
				    	var status = record.get('authStatusDsid');
				    	//alert(status);
				        if (status === 5 || status === 1) {
				            return false;
				        } else {
				        	return true;
				        }
				    }
	            }]
            }];
        this.bbar= {
            xtype: 'pagingtoolbar',
            store: 'Video',
            pageSize: 16,
            displayInfo: true,
            firstText:'首页',
            prevText:'上一页',
            nextText:'下一页',
            beforePageText:'第',
            afterPageText:'共  {0} 页',
            displayMsg: '显示第 {0} 条到 {1} 条记录，一共 {2} 条', 
            emptyMsg: "没有记录",
            refreshText:'刷新',
            lastText:'未页'
        };
        this.callParent();
    }
});